<template>
  <header>
    <section>
      <!-- 阻止表单的默认提交事件 -->
      <label for="title">ToDoList</label>
      <input
        type="text"
        placeholder="添加ToDo"
        v-model="iptVal"
        @keydown.enter="submit"
      />
    </section>
  </header>
</template>

<script>
import { reactive, ref, watch } from "vue";

export default {
  setup(props, { emit }) {
    let iptVal = ref("");
    const submit = () => {
      let obj = reactive;
      emit("submit", iptVal.value);
    };
    return {
      iptVal,
      submit,
    };
  },
};
</script>

<style></style>
